home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Shutdown FX 1.3 Source / Shutdown FX ƒ / sfx wipes ƒ / Rescue Raiders.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  2.7 KB  |  104 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Rescue Raiders.c
  4.  
  5. Purpose:    This module handles clearing the screen in a funky
  6.             manner.  See the comments below for more details.
  7.             
  8.  
  9. Shutdown FX -=- graphic effects on shutdown
  10. Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define NUMREGIONS 25
  32. #define BlockSize 10
  33. #define CorrectTime 5
  34.  
  35. void RescueRaiders(Pattern *thePattern, int width, int height);
  36.  
  37. /* One region in 8 parts.  Each part of the region either starts at a corner
  38.    or in the middle of a side and moves progressively clockwise until the
  39.    entire screen is filled. Named after a similar effect in the game Rescue
  40.    Raiders on the Apple ][e (now called Armor Alley™ on the Mac, but it doesn't
  41.    have this effect in it anymore). */
  42.    
  43. void RescueRaiders(Pattern *thePattern, int width, int height)
  44. {
  45.     RgnHandle    curregion;
  46.     Rect        source;
  47.     int            cx,cy,lastx,lasty,VBlockSize;
  48.     
  49.     cx = width / 2;
  50.     cy = height / 2;
  51.     VBlockSize=BlockSize*height/width;
  52.  
  53.     source.top=source.left=0;
  54.     source.bottom=height;
  55.     source.right=width;
  56.     
  57.     lasty=lastx=0;
  58.     curregion=NewRgn();
  59.     do
  60.     {
  61.         StartTiming();
  62.  
  63.         SetEmptyRgn(curregion);
  64.         MoveTo(cx,cy);
  65.         OpenRgn();
  66.             LineTo(lastx,0);
  67.             Line(BlockSize,0);
  68.             LineTo(width-lastx-BlockSize,height);
  69.             Line(BlockSize,0);
  70.             LineTo(cx,cy);
  71.             
  72.             LineTo(cx+lastx,0);
  73.             Line(BlockSize,0);
  74.             LineTo(cx-lastx-BlockSize,height);
  75.             Line(BlockSize,0);
  76.             LineTo(cx,cy);
  77.             
  78.             LineTo(width,lasty);
  79.             Line(0,VBlockSize);
  80.             LineTo(0,height-lasty-VBlockSize);
  81.             Line(0,VBlockSize);
  82.             LineTo(cx,cy);
  83.             
  84.             LineTo(width,cy+lasty);
  85.             Line(0,VBlockSize);
  86.             LineTo(0,cy-lasty-VBlockSize);
  87.             Line(0,VBlockSize);
  88.             LineTo(cx,cy);
  89.         CloseRgn(curregion);
  90.  
  91.         FillRgn(curregion, *thePattern);
  92.         
  93.         lastx+=BlockSize;
  94.         lasty+=VBlockSize;
  95.  
  96.         TimeCorrection(CorrectTime);
  97.     }
  98.     while (lastx<cx);
  99.     
  100.     FillRect(&source, *thePattern);    /* in case we missed any bits */
  101.     
  102.     DisposeRgn(curregion);
  103. }
  104.